feat: add legacy beta map compatibility interfaces#27240
feat: add legacy beta map compatibility interfaces#27240jenn-le wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (182 lines, 10 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
Adds new legacy/beta “Map-compatible” typing surfaces so legacy DDS APIs can align with JavaScript Map signatures while still participating in Fluid’s stable FluidMap abstraction shape.
Changes:
- Introduces
FluidMapLegacy<K, V>in@fluidframework/core-interfaces(legacy/beta) to preserveMap-style mutator returns (delete(): boolean,set(): this) andclear(). - Adds
IDirectoryBetaandISharedMapBeta(legacy/beta) that replace the built-inMapinheritance withFluidMapLegacyviaOmit<..., keyof Map<...>>. - Adds compile-time type tests and updates API reports + changeset to validate/ship the new legacy surfaces.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/map/src/test/types/fluidMapLegacyTypes.ts | Adds type-level assertions validating *Beta assignability to FluidMapLegacy and Map. |
| packages/dds/map/src/interfaces.ts | Introduces IDirectoryBeta / ISharedMapBeta using FluidMapLegacy for map-like API shape. |
| packages/dds/map/src/index.ts | Re-exports the new beta interfaces from the package surface (gated by @legacy @beta tags). |
| packages/dds/map/api-report/map.legacy.beta.api.md | Updates legacy beta API report to include the new beta interfaces. |
| packages/common/core-interfaces/src/test/types/fluidMapTypes.ts | Adds type-level assertions for FluidMapLegacy compatibility with FluidMap and Map. |
| packages/common/core-interfaces/src/index.ts | Exports FluidMapLegacy from the package index (release-tag filtered into legacy typings). |
| packages/common/core-interfaces/src/fluidMap.ts | Defines FluidMapLegacy<K, V> (legacy/beta) extending FluidMap with Map-style mutators. |
| packages/common/core-interfaces/api-report/core-interfaces.legacy.beta.api.md | Updates legacy beta API report to include FluidMapLegacy. |
| packages/common/core-interfaces/api-report/core-interfaces.legacy.alpha.api.md | Updates legacy alpha API report to include FluidMapLegacy (alpha rollup includes beta surfaces). |
| .changeset/lazy-lies-enjoy.md | Adds changeset bumping @fluidframework/core-interfaces and @fluidframework/map for the new legacy/beta types. |
Co-authored-by: Copilot <copilot@github.com>
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
| * | ||
| * @sealed @legacy @beta | ||
| */ | ||
| export interface FluidMapLegacy<K, V> extends FluidMap<K, V> { |
There was a problem hiding this comment.
Do we plan to ever use this for anything other than shared map and shared directory? If not, it should probably be in that package.
There was a problem hiding this comment.
If you do move this, you should be able to inline the questionable get and set APIs those maps use here, which would simplify things a bit.
| * | ||
| * @returns The map itself. | ||
| */ | ||
| set(key: K, value: V): this; |
There was a problem hiding this comment.
Don't we override/omit this in all cases that use this interface? Maybe we don't need to state it here?
Description
Adds legacy beta map compatibility interfaces for APIs that need to align with JavaScript
Mapwhile still using Fluid's map abstraction.This change introduces
FluidMapLegacyin@fluidframework/core-interfaces/legacy. It extendsFluidMapand only adds the legacy/built-inMap-style members needed for compatibility:clear,deletereturningboolean,setreturningthis, and aforEachcallback typed withFluidMapLegacy.This also adds
IDirectoryBetaandISharedMapBetain@fluidframework/map/legacy. The existingIDirectoryandISharedMapinterfaces are unchanged and continue to extend the built-inMap; the new beta variants provide an opt-in shape that consumesFluidMapLegacy.